package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInInvoice14;
import com.ims.core.doc.service.ITInInvoice14Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 14 增值税电子普通发票(通行费) Controller
 *
 * @author IMS
 * @date 2024-12-01
 */
@RestController
@RequestMapping("/doc/dianzitongxingfei")
public class TInInvoice14Controller extends BaseController
{
    @Autowired
    private ITInInvoice14Service tInInvoice14Service;

    /**
     * 查询14 增值税电子普通发票(通行费) 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInInvoice14 tInInvoice14)
    {
        startPage();
        List<TInInvoice14> list = tInInvoice14Service.selectTInInvoice14List(tInInvoice14);
        return getDataTable(list);
    }

    /**
     * 导出14 增值税电子普通发票(通行费) 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:export')")
    @Log(title = "14 增值税电子普通发票(通行费) ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInInvoice14 tInInvoice14)
    {
        List<TInInvoice14> list = tInInvoice14Service.selectTInInvoice14List(tInInvoice14);
        ExcelUtil<TInInvoice14> util = new ExcelUtil<TInInvoice14>(TInInvoice14.class);
        util.exportExcel(response, list, "14 增值税电子普通发票(通行费) 数据");
    }

    /**
     * 获取14 增值税电子普通发票(通行费) 详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInInvoice14Service.selectTInInvoice14ById(id));
    }

    /**
     * 新增14 增值税电子普通发票(通行费) 
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:add')")
    @Log(title = "14 增值税电子普通发票(通行费) ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInInvoice14 tInInvoice14)
    {
        return toAjax(tInInvoice14Service.insertTInInvoice14(tInInvoice14));
    }

    /**
     * 修改14 增值税电子普通发票(通行费) 
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:edit')")
    @Log(title = "14 增值税电子普通发票(通行费) ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInInvoice14 tInInvoice14)
    {
        return toAjax(tInInvoice14Service.updateTInInvoice14(tInInvoice14));
    }

    /**
     * 删除14 增值税电子普通发票(通行费) 
     */
    @PreAuthorize("@ss.hasPermi('doc:dianzitongxingfei:remove')")
    @Log(title = "14 增值税电子普通发票(通行费) ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInInvoice14Service.deleteTInInvoice14ByIds(ids));
    }
}
